import { Command } from '@/commands/command.ts'
import { new_command } from '@/models/command.ts'

export class RandStrCommand extends Command {
    public static new(args: string): Command {
        const command = new_command()
        command.args = args
        command.name = 'randstr'
        command.component = 'AllowCopyCommandComponent'

        return new RandStrCommand(command, false)
    }

    usage(): string {
        return 'randstr [-n 长度] [-l] [-u] [-s] [-d] [-c 字符集]'
    }

    description(): string {
        return `<div>生成随机字符串</div>
        <br/>
        <div>选项说明:</div>
        <br/>
        <div class="option-row"><span class="option-option">-n --number</span><span>字符串长度，默认为10</span></div>
        <div class="option-row"><span class="option-option">-l --lower</span><span>允许出现小写字符，所有选项均不指定时为true，指定任意其它选项时为false</span></div>
        <div class="option-row"><span class="option-option">-u --upper</span><span>允许出现大写字符，所有选项均不指定时为true，指定任意其它选项时为false</span></div>
        <div class="option-row"><span class="option-option">-s --symbol</span><span>允许出现符号，所有选项均不指定时为true，指定任意其它选项时为false</span></div>
        <div class="option-row"><span class="option-option">-d --digit</span><span>允许出现数字，所有选项均不指定时为true，指定任意其它选项时为false</span></div>
        <div class="option-row"><span class="option-option">-c --characters</span><span>自定义字符集，指定此选项时其他除-n外其它选项无效</span></div>`
    }
}
